﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace EFITransmissao
{
    public partial class FrmConsultarRoteiro : Form
    {
        public FrmConsultarRoteiro()
        {
            InitializeComponent();
        }

        private void mnFechar_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CarregarDados()
        {
            DataTable dt = Controle.CtlControle.ObterRotaDiasLeitura();

            foreach (DataRow dr in dt.Rows)
            {
                txtRota.Text = dr["Roteiro"].ToString();
                txtDiasDeLeitura.Text = "De: " + dr["DtLeitInicio"].ToString() + " até: " + dr["DtLeitFim"].ToString();
            }

            dt = Controle.CtlLeitura.ObterTodosLeituraEnderecos();

            foreach (DataRow item in dt.Rows)
            {
                lstEnderecos.Items.Add(item[0].ToString());
            }
                        
            txtReg.Text = "Total: " + dt.Rows.Count;

            if (dt.Rows.Count == 0)
                this.Close();

        }

        private void FrmConsultarRoteiro_Load(object sender, EventArgs e)
        {
            CarregarDados();
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
               
    }
}